home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Games / MAME / src / drivers / z80bw.c < prev    next >
C/C++ Source or Header  |  2000-05-25  |  13KB  |  404 lines

  1. /***************************************************************************
  2.  
  3. Midway?? Z80 board memory map (preliminary)
  4.  
  5.  
  6. 0000-1bff ROM
  7. 2000-23ff RAM
  8. 2400-3fff Video RAM  (also writes between 4000 and 4fff, but only to simplify
  9.                       code, ie. doesn't do clipping when the spaceship scrolls in)
  10.  
  11. Games which are referenced by this driver:
  12. ------------------------------------------
  13. Astro Invader (astinvad)
  14. Kamikaze (kamikaze)
  15. Space Intruder (spaceint)
  16.  
  17. I/O ports:
  18. read:
  19. 08        IN0
  20. 09        IN1
  21. 0a        IN2
  22.  
  23. write:
  24. 04        sound
  25. 05        sound
  26. 07          ???
  27. 0b          ???
  28.  
  29. TODO:
  30.  
  31. - How many sets of controls are there on an upright machine?
  32.  
  33. ***************************************************************************/
  34.  
  35. #include "driver.h"
  36. #include "vidhrdw/generic.h"
  37.  
  38. int  astinvad_interrupt(void);
  39.  
  40. int invaders_vh_start(void);
  41. void invaders_vh_stop(void);
  42.  
  43. void invadpt2_vh_convert_color_prom(unsigned char *palette, unsigned short *colortable,const unsigned char *color_prom);
  44. WRITE_HANDLER( invaders_videoram_w );
  45. void invaders_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh);
  46.  
  47. WRITE_HANDLER( astinvad_sh_port_4_w );
  48. WRITE_HANDLER( astinvad_sh_port_5_w );
  49. void astinvad_sh_update(void);
  50.  
  51. void init_astinvad(void);
  52. void init_spaceint(void);
  53.  
  54. extern struct Samplesinterface astinvad_samples_interface;
  55.  
  56.  
  57. static struct MemoryReadAddress astinvad_readmem[] =
  58. {
  59.     { 0x0000, 0x1bff, MRA_ROM },
  60.     { 0x1c00, 0x3fff, MRA_RAM },
  61.     { -1 }  /* end of table */
  62. };
  63.  
  64. static struct MemoryWriteAddress astinvad_writemem[] =
  65. {
  66.     { 0x0000, 0x1bff, MWA_ROM },
  67.     { 0x1c00, 0x23ff, MWA_RAM },
  68.     { 0x2400, 0x3fff, invaders_videoram_w, &videoram, &videoram_size },
  69.     { -1 }  /* end of table */
  70. };
  71.  
  72.  
  73. static struct IOReadPort astinvad_readport[] =
  74. {
  75.     { 0x08, 0x08, input_port_1_r },
  76.     { 0x09, 0x09, input_port_2_r },
  77.     { 0x0a, 0x0a, input_port_3_r },
  78.     { -1 }  /* end of table */
  79. };
  80.  
  81. static struct IOWritePort astinvad_writeport[] =
  82. {
  83.     { 0x04, 0x04, astinvad_sh_port_4_w },
  84.     { 0x05, 0x05, astinvad_sh_port_5_w },
  85.     { -1 }  /* end of table */
  86. };
  87.  
  88.  
  89. INPUT_PORTS_START( astinvad )
  90.     PORT_START    /* FAKE - select cabinet type */
  91.     PORT_DIPNAME( 0x01, 0x00, DEF_STR( Cabinet ) )
  92.     PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
  93.     PORT_DIPSETTING(    0x01, DEF_STR( Cocktail ) )
  94.     PORT_BIT( 0xfe, IP_ACTIVE_HIGH, IPT_UNUSED )
  95.  
  96.     PORT_START      /* IN0 */
  97.     PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 )
  98.     PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_START2 )
  99.     PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_START1 )
  100.     PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  101.     PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1 )
  102.     PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT | IPF_2WAY )
  103.     PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT | IPF_2WAY )
  104.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
  105.  
  106.     PORT_START      /* IN1 */
  107.     PORT_DIPNAME( 0x01, 0x00, DEF_STR( Lives ) )
  108.     PORT_DIPSETTING(    0x00, "3" )
  109.     PORT_DIPSETTING(    0x01, "4" )
  110.     PORT_DIPNAME( 0x02, 0x02, DEF_STR( Bonus_Life ) )
  111.     PORT_DIPSETTING(    0x02, "10000" )
  112.     PORT_DIPSETTING(    0x00, "20000" )
  113.     PORT_DIPNAME( 0x04, 0x00, DEF_STR( Unknown ) )
  114.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  115.     PORT_DIPSETTING(    0x04, DEF_STR( On ) )
  116.     PORT_DIPNAME( 0x88, 0x00, DEF_STR( Coinage ) )
  117.     PORT_DIPSETTING(    0x88, DEF_STR( 3C_1C ) )
  118.     PORT_DIPSETTING(    0x80, DEF_STR( 2C_1C ) )
  119.     PORT_DIPSETTING(    0x00, DEF_STR( 1C_1C ) )
  120.     PORT_DIPSETTING(    0x08, DEF_STR( 1C_2C ) )
  121.     PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1 | IPF_PLAYER2 )
  122.     PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT | IPF_2WAY | IPF_PLAYER2 )
  123.     PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT | IPF_2WAY | IPF_PLAYER2 )
  124.  
  125.     PORT_START      /* IN2 */
  126.     PORT_DIPNAME( 0x01, 0x00, "Freeze" )
  127.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  128.     PORT_DIPSETTING(    0x01, DEF_STR( On ) )
  129.     PORT_BIT( 0xfe, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  130. INPUT_PORTS_END
  131.  
  132. INPUT_PORTS_START( kamikaze )
  133.     PORT_START    /* FAKE - select cabinet type */
  134.     PORT_DIPNAME( 0x01, 0x00, DEF_STR( Cabinet ) )
  135.     PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
  136.     PORT_DIPSETTING(    0x01, DEF_STR( Cocktail ) )
  137.     PORT_BIT( 0xfe, IP_ACTIVE_HIGH, IPT_UNUSED )
  138.  
  139.     PORT_START      /* IN0 */
  140.     PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 )
  141.     PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_START2 )
  142.     PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_START1 )
  143.     PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  144.     PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1 )
  145.     PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT | IPF_2WAY )
  146.     PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT | IPF_2WAY )
  147.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
  148.  
  149.     PORT_START      /* IN1 */
  150.     PORT_DIPNAME( 0x03, 0x03, DEF_STR( Lives ) )
  151.     PORT_DIPSETTING(    0x03, "3" )
  152.     PORT_DIPSETTING(    0x01, "4" )
  153.     PORT_DIPSETTING(    0x02, "5" )
  154.     PORT_DIPSETTING(    0x00, "6" )
  155.     PORT_DIPNAME( 0x04, 0x00, DEF_STR( Unknown ) )
  156.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  157.     PORT_DIPSETTING(    0x04, DEF_STR( On ) )
  158.     PORT_DIPNAME( 0x88, 0x88, DEF_STR( Bonus_Life ) )
  159.     PORT_DIPSETTING(    0x88, "5000" )
  160.     PORT_DIPSETTING(    0x80, "10000" )
  161.     PORT_DIPSETTING(    0x08, "15000" )
  162.     PORT_DIPSETTING(    0x00, "20000" )
  163.     PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1 | IPF_PLAYER2 )
  164.     PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT | IPF_2WAY | IPF_PLAYER2 )
  165.     PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT | IPF_2WAY | IPF_PLAYER2 )
  166.  
  167.     PORT_START      /* IN2 */
  168.     PORT_DIPNAME( 0x01, 0x00, "Freeze" )
  169.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  170.     PORT_DIPSETTING(    0x01, DEF_STR( On ) )
  171.     PORT_BIT( 0xfe, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  172. INPUT_PORTS_END
  173.  
  174. static struct MachineDriver machine_driver_astinvad = /* LT */
  175. {
  176.     /* basic machine hardware */
  177.     {
  178.         {
  179.             CPU_Z80,
  180.             2000000,        /* 2 Mhz? */
  181.             astinvad_readmem,astinvad_writemem,astinvad_readport,astinvad_writeport,
  182.             interrupt,1    /* two interrupts per frame */
  183.         }
  184.     },
  185.     60, DEFAULT_60HZ_VBLANK_DURATION,       /* frames per second, vblank duration */
  186.     1,      /* single CPU, no need for interleaving */
  187.     0,
  188.  
  189.     /* video hardware */
  190.     32*8, 32*8, { 0*8, 32*8-1, 0*8, 28*8-1 },
  191.     0,      /* no gfxdecodeinfo - bitmapped display */
  192.     8, 0,
  193.     invadpt2_vh_convert_color_prom,
  194.  
  195.     VIDEO_TYPE_RASTER | VIDEO_SUPPORTS_DIRTY | VIDEO_MODIFIES_PALETTE,
  196.     0,
  197.     invaders_vh_start,
  198.     invaders_vh_stop,
  199.     invaders_vh_screenrefresh,
  200.  
  201.     /* sound hardware */
  202.     0, 0, 0, 0,
  203.     {
  204.         {
  205.             SOUND_SAMPLES,
  206.             &astinvad_samples_interface
  207.         }
  208.     }
  209. };
  210.  
  211.  
  212.  
  213. /***************************************************************************
  214.  
  215.   Game driver(s)
  216.  
  217. ***************************************************************************/
  218.  
  219.  
  220. /*------------------------------------------------------------------------------
  221.  Shoei Space Intruder
  222.  Added By Lee Taylor (lee@defender.demon.co.uk)
  223.  December 1998
  224. ------------------------------------------------------------------------------*/
  225.  
  226.  
  227. static int spaceint_interrupt(void)
  228. {
  229.     if (readinputport(3) & 1)    /* Coin */
  230.         return nmi_interrupt();
  231.     else return interrupt();
  232. }
  233.  
  234.  
  235. static struct MemoryReadAddress spaceint_readmem[] =
  236. {
  237.     { 0x0000, 0x17ff, MRA_ROM },
  238.     { 0x2000, 0x23ff, MRA_RAM },
  239.     { 0x4000, 0x5fff, MRA_RAM },
  240.     { -1 }  /* end of table */
  241. };
  242.  
  243. static struct MemoryWriteAddress spaceint_writemem[] =
  244. {
  245.     { 0x0000, 0x17ff, MWA_ROM },
  246.     { 0x2000, 0x23ff, MWA_RAM },
  247.     { 0x4000, 0x40ff, MWA_RAM },
  248.     { 0x4100, 0x5fff, invaders_videoram_w, &videoram, &videoram_size },
  249.     { -1 }  /* end of table */
  250. };
  251.  
  252.  
  253. static struct IOReadPort spaceint_readport[] =
  254. {
  255.     { 0x00, 0x00, input_port_1_r },
  256.     { 0x01, 0x01, input_port_2_r },
  257.     { -1 }  /* end of table */
  258. };
  259.  
  260. static struct IOWritePort spaceint_writeport[] =
  261. {
  262.     { -1 }  /* end of table */
  263. };
  264.  
  265.  
  266. INPUT_PORTS_START( spaceint )
  267.     PORT_START    /* FAKE - select cabinet type */
  268.     PORT_DIPNAME( 0x01, 0x00, DEF_STR( Cabinet ) )
  269.     PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
  270.     PORT_DIPSETTING(    0x01, DEF_STR( Cocktail ) )
  271.     PORT_BIT( 0xfe, IP_ACTIVE_HIGH, IPT_UNUSED )
  272.  
  273.     PORT_START      /* IN0 */
  274.     PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_START1 )
  275.     PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_START2  )
  276.     PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT | IPF_2WAY)
  277.     PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT | IPF_2WAY  )
  278.     PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1 )
  279.     PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT | IPF_2WAY | IPF_PLAYER2)
  280.     PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT | IPF_2WAY | IPF_PLAYER2)
  281.     PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_BUTTON1 | IPF_PLAYER2)
  282.  
  283.     PORT_START      /* IN1 */
  284.     PORT_DIPNAME( 0x01, 0x00, DEF_STR( Unknown ) )
  285.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  286.     PORT_DIPSETTING(    0x01, DEF_STR( On ) )
  287.     PORT_DIPNAME( 0x06, 0x00, DEF_STR( Lives ) )
  288.     PORT_DIPSETTING(    0x00, "3" )
  289.     PORT_DIPSETTING(    0x04, "4" )
  290.   //PORT_DIPSETTING(    0x06, "4" )
  291.     PORT_DIPSETTING(    0x02, "5" )
  292.     PORT_DIPNAME( 0x08, 0x00, DEF_STR( Coinage ) )
  293.     PORT_DIPSETTING(    0x00, DEF_STR( 1C_1C ) )
  294.     PORT_DIPSETTING(    0x08, DEF_STR( 1C_2C ) )
  295.     PORT_DIPNAME( 0x10, 0x00, DEF_STR( Unknown ) )
  296.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  297.     PORT_DIPSETTING(    0x10, DEF_STR( On ) )
  298.     PORT_DIPNAME( 0x20, 0x00, DEF_STR( Unknown ) )
  299.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  300.     PORT_DIPSETTING(    0x20, DEF_STR( On ) )
  301.     PORT_DIPNAME( 0x40, 0x00, DEF_STR( Unknown ) )
  302.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  303.     PORT_DIPSETTING(    0x40, DEF_STR( On ) )
  304.     PORT_DIPNAME( 0x80, 0x00, DEF_STR( Unknown ) )
  305.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  306.     PORT_DIPSETTING(    0x80, DEF_STR( On ) )
  307.  
  308.     PORT_START    /* FAKE */
  309.     /* The coin slots are not memory mapped. Coin insertion causes a NMI. */
  310.     /* This fake input port is used by the interrupt */
  311.     /* handler to be notified of coin insertions. We use IMPULSE to */
  312.     /* trigger exactly one interrupt, without having to check when the */
  313.     /* user releases the key. */
  314.     PORT_BIT_IMPULSE( 0x01, IP_ACTIVE_HIGH, IPT_COIN1, 1 )
  315. INPUT_PORTS_END
  316.  
  317.  
  318. static struct MachineDriver machine_driver_spaceint = /* 20-12-1998 LT */
  319. {
  320.     /* basic machine hardware */
  321.     {
  322.         {
  323.             CPU_Z80,
  324.             2000000,        /* 2 Mhz? */
  325.             spaceint_readmem,spaceint_writemem,spaceint_readport,spaceint_writeport,
  326.             spaceint_interrupt,1
  327.         }
  328.     },
  329.     60, DEFAULT_60HZ_VBLANK_DURATION,       /* frames per second, vblank duration */
  330.     1,      /* single CPU, no need for interleaving */
  331.     0,
  332.  
  333.     /* video hardware */
  334.     //32*8, 32*8, { 0*8, 32*8-1, 0*8, 32*8-1 },
  335.     32*8, 32*8, { 0*8, 32*8-1, 0*8, 32*8-1 },
  336.     0,      /* no gfxdecodeinfo - bitmapped display */
  337.     8, 0,
  338.     invadpt2_vh_convert_color_prom,
  339.  
  340.     VIDEO_TYPE_RASTER | VIDEO_SUPPORTS_DIRTY | VIDEO_MODIFIES_PALETTE,
  341.     0,
  342.     invaders_vh_start,
  343.     invaders_vh_stop,
  344.     invaders_vh_screenrefresh,
  345.  
  346.     /* sound hardware */
  347.     0, 0, 0, 0,
  348.     {
  349.         {
  350.             SOUND_SAMPLES,
  351.             &astinvad_samples_interface
  352.         }
  353.     }
  354. };
  355.  
  356.  
  357.  
  358.  
  359.  
  360.  
  361. ROM_START( astinvad )
  362.     ROM_REGION( 0x10000, REGION_CPU1 )     /* 64k for code */
  363.     ROM_LOAD( "ai_cpu_1.rom", 0x0000, 0x0400, 0x20e3ec41 )
  364.     ROM_LOAD( "ai_cpu_2.rom", 0x0400, 0x0400, 0xe8f1ab55 )
  365.     ROM_LOAD( "ai_cpu_3.rom", 0x0800, 0x0400, 0xa0092553 )
  366.     ROM_LOAD( "ai_cpu_4.rom", 0x0c00, 0x0400, 0xbe14185c )
  367.     ROM_LOAD( "ai_cpu_5.rom", 0x1000, 0x0400, 0xfee681ec )
  368.     ROM_LOAD( "ai_cpu_6.rom", 0x1400, 0x0400, 0xeb338863 )
  369.     ROM_LOAD( "ai_cpu_7.rom", 0x1800, 0x0400, 0x16dcfea4 )
  370.  
  371.     ROM_REGION( 0x0400, REGION_PROMS )
  372.     ROM_LOAD( "ai_vid_c.rom", 0x0000, 0x0400, 0xb45287ff )
  373. ROM_END
  374.  
  375. ROM_START( kamikaze )
  376.     ROM_REGION( 0x10000, REGION_CPU1 )     /* 64k for code */
  377.     ROM_LOAD( "km01",         0x0000, 0x0800, 0x8aae7414 )
  378.     ROM_LOAD( "km02",         0x0800, 0x0800, 0x6c7a2beb )
  379.     ROM_LOAD( "km03",         0x1000, 0x0800, 0x3e8dedb6 )
  380.     ROM_LOAD( "km04",         0x1800, 0x0800, 0x494e1f6d )
  381.  
  382.     ROM_REGION( 0x0400, REGION_PROMS )
  383.     ROM_LOAD( "ai_vid_c.rom", 0x0000, 0x0400, BADCRC(0xb45287ff) )
  384. ROM_END
  385.  
  386. ROM_START( spaceint )
  387.     ROM_REGION( 0x10000, REGION_CPU1 )     /* 64k for code */
  388.     ROM_LOAD( "1",     0x0000, 0x0400, 0x184314d2 )
  389.     ROM_LOAD( "2",     0x0400, 0x0400, 0x55459aa1 )
  390.     ROM_LOAD( "3",     0x0800, 0x0400, 0x9d6819be )
  391.     ROM_LOAD( "4",     0x0c00, 0x0400, 0x432052d4 )
  392.     ROM_LOAD( "5",     0x1000, 0x0400, 0xc6cfa650 )
  393.     ROM_LOAD( "6",     0x1400, 0x0400, 0xc7ccf40f )
  394.  
  395.     ROM_REGION( 0x0100, REGION_PROMS )
  396.     ROM_LOAD( "clr", 0x0000, 0x0100, 0x13c1803f )
  397. ROM_END
  398.  
  399.  
  400.  
  401. GAME( 1980, astinvad, 0,        astinvad, astinvad, astinvad, ROT270, "Stern", "Astro Invader" )
  402. GAME( 1979, kamikaze, astinvad, astinvad, kamikaze, astinvad, ROT270, "Leijac Corporation", "Kamikaze" )
  403. GAMEX(1980, spaceint, 0,        spaceint, spaceint, spaceint, ROT0,   "Shoei", "Space Intruder", GAME_WRONG_COLORS | GAME_NO_SOUND )
  404.